package LC525;

import java.util.Scanner;

public class ADD {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("输入数组：");
        int[] nums=new int[4];
        for (int i = 0; i < nums.length; i++) {
            nums[i]= sc.nextInt();
        }
        System.out.println("输入目标数字：");
        int target=sc.nextInt();
        for (int i = 0; i < 2; i++) {
            System.out.println(twoSum(nums,target)[i]);
        }

    }
    public static int[] twoSum(int[] nums, int target) {
        int n1=0;
        int n2=0;
        int[] two=new int[2];
        for (int i = 0; i < nums.length; i++) {
            for (int i1 = i+1; i1 < nums.length; i1++) {
                if(nums[i]+nums[i1]==target){
                    n1=i;
                    n2=i1;
                    break;
                }
            }
        }
        two[0]=n1;
        two[1]=n2;
        return two;
    }
}
